package elasticSearch.Controller;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

@Service
//public class EmailService implements ApplicationListener<UserRegisterEvent> {
//    @Override
//    public void onApplicationEvent(UserRegisterEvent userRegisterEvent) {
//        UserRegisterBO userRegisterBO = (UserRegisterBO) userRegisterEvent.getSource();
//
//        System.out.println("邮件服务接到通知，给 " + userRegisterBO.getName() + " 发送邮件...");
//    }
//}

public class EmailService {
    @EventListener
    public void onApplicationEvent(UserRegisterEvent userRegisterEvent) {
        UserRegisterBO userRegisterBO = (UserRegisterBO) userRegisterEvent.getSource();

        System.out.println("邮件服务接到通知，给 " + userRegisterBO.getName() + " 发送邮件...");
    }
}
